extends layout

block content
  include includes/navbar.pug
  h1 图片分享
  .row
    .col-12.col-md-8
      .card.mt-1.mb-1
        .card-body
          form(action="/images/", method="post", enctype="multipart/form-data")
            .form-group.row
              label.col-12.col-md-2 浏览
              input.col-12.col-md-10.form-control-file(type='file',name='imgfile')
            .form-group.row
              label.col-12.col-md-2 标题
              input.col-12.col-md-10.form-control(type='text', name='title')
            .form-group.row
              label.col-12.col-md-2 描述
              input.col-12.col-md-10.form-control(type='text', name='description')
            .form-group.row
              .col-12.offset-md-8.col-md-4
                button.btn.btn-primary.btn-block(type='submit') 提交
    .col-12.col-md-4
      include includes/stats.pug
  .row
    .col-12.col-md-8
      .row
        each image in images
          a.col-6.col-md-4(href=`/images/${image._id}`)
            .card
              img.card-img-top(src=`/uploads/${image.diskfilename}`, alt=image.title)
              .card-body
                h5.card-title= image.title
                p.card-text= image.description



                 div.card.col-12.col-md-3.ml-5.mt-1(style="width: 18rem;")
              img.card-img-top.mt-2(src="/uploads/" + comment.imagediskname, style="height: 9rem")
              div.card-body
                h5.card-title= comment.nickname
                p.card-text 
                  span= comment.comment
                a.btn.btn-primary(href="/images/" + comment.image + "#comments")